module Authorizer
  include AdminModule
  def login_check
    unless  session[:user]
      flash[:error] = "You should be logged in in order to view this page!"
      session[:url_wanted] = request.url
      redirect_to :controller => :session,:action => :login
    end 
  end

  def admin_check
    if  !session[:user]
      flash[:error] = "You should be logged in as an admin in order to view this page"
      redirect_to :controller => :session,:action => :login
    else
      unless admin? session[:user]
        flash[:error] = "Only admins can view this page"
        redirect_to :controller => :spoj1,:action => :index
      end
    end
  end
end
